import { http } from "@/utils/http";
import baseUrlProxy from "@/api/baseUrlProxy";
export type VppUserItem = {
  address: string;
  altitude: number;
  area: string;
  capRate: string;
  capRefund: string;
  contactName: string;
  contactTel: string;
  createBy: string;
  createTime: string;
  dispatchName: string;
  distributionNo: string;
  districtId: number;
  emsCode: string;
  emsIpadd: string;
  equipNum: number;
  equipOnnum: number;
  fullName: string;
  govFundRate: number;
  gridRate: number;
  gridVoltageLevel: number;
  groupName: string;
  hisCode: number;
  hisIpadd: number;
  id: number;
  inMarket: number;
  initOnlineTime: string;
  latitude: number;
  longitude: number;
  longitudeAndLatitude: string;
  maxLoad: number;
  maxOutput: number;
  name: string;
  offlineTime: string;
  onlineTime: string;
  powerBroker: string;
  sector: number;
  sectorInfo: string;
  shareRatio: number;
  shareRevenue: number;
  status: number;
  storageNum: number;
  storageOnnum: number;
  substationName: string;
  terminalNum: number;
  terminalOnnum: number;
  totalEnergy: number;
  totalP: number;
  totalQ: number;
  totalRevenue: number;
  updateBy: string;
  updateTime: string;
};
export type ResultVppUserList = {
  content: VppUserItem[];
  totalElements: number;
};

export const getVppUserList = (data?: object) => {
  return http.request<VppUserItem>("get", baseUrlProxy + "/api/vpp_user", {
    params: data
  });
};
export const operationBaseLine = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/base_line/operationBaseLine",
    {
      params: data
    }
  );
};
export const getBaseLine = (data?: object) => {
  return http.request<any>("get", baseUrlProxy + "/api/base_line", {
    params: data
  });
};
export const getVppUserListAll = (data?: object) => {
  return http.request<any>("get", baseUrlProxy + "/api/vpp_user/query_all", {
    params: data
  });
};
export const getVppListAll = (data?: object) => {
  return http.request<any>("get", baseUrlProxy + "/api/vpp_info/getVppInfo", {
    params: data
  });
};
export const getVppUserDetail = id => {
  return http.request<ResultVppUserList>(
    "get",
    baseUrlProxy + "/api/vpp_user/id/" + id
  );
};
export const addVppUserList = (data?: object) => {
  return http.request<any>("post", baseUrlProxy + "/api/vpp_user", {
    data: data
  });
};

export const editVppUserList = (data?: object) => {
  return http.request<any>("put", baseUrlProxy + "/api/vpp_user", {
    data: data
  });
};

export const delVppUserList = (data?: object) => {
  return http.request<any>("delete", baseUrlProxy + "/api/vpp_user", {
    data: data
  });
};

export const exportVppUserList = (data?: object) => {
  return http.request<any>(
    "get",
    baseUrlProxy + "/api/vpp_user/download",
    { params: data },
    { responseType: "blob" }
  );
};
export const getDistrictInfo = (data?: object) => {
  return http.request<any>("get", baseUrlProxy + "/api/districtInfo/lazy", {
    params: data
  });
};
